<html>
<head>
    {code:"house/_ainit"}
    <style type="text/css">
        body, html{width: 100%;height: 100%; margin:0;font-family:"微软雅黑";}
        #l-map{height:300px;width:100%;}
        #r-cy, #r-gy{width:45%;}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=54df74a9ff8a54471a6eb1200eeff8ea"></script>
    <title>本地搜索的结果面板</title>
</head>
<body>
    <div id="l-map"></div>
    <div id="r-cy" style="float:right;"></div>
    <div id="r-gy"></div>
</body>
</html>
<script type="text/javascript">
    // 百度地图API功能
    var map = new BMap.Map("l-map");            // 创建Map实例
    map.centerAndZoom(new BMap.Point(116.404, 39.915), 11);
    var local = new BMap.LocalSearch(map, {
        renderOptions: {map: map, panel: "r-cy"}
    });
    local.search("餐饮");

    var options = {
        onSearchComplete: function(results){
            // 判断状态是否正确
            if (local.getStatus() == BMAP_STATUS_SUCCESS){
                var s = [];
                for (var i = 0; i < results.getCurrentNumPois(); i ++){
                    console.log(results.getPoi(i));
                    s.push(results.getPoi(i).title + ", " + results.getPoi(i).address);
                }
                document.getElementById("r-gy").innerHTML = s.join("<br/>");
            }
        }
    };
    var local = new BMap.LocalSearch(map, options);
    local.search("公园"); // ktv

</script>
